﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HA.ModFlow.Application
{
    public class RecentProjectViewModel
    {

        private  object _lockObject = new object();
        private  Dictionary<string, ControlData> _dataCollection = new Dictionary<string, ControlData>();


        public  ControlData RecentDocuments
        {
            get
            {
                lock (_lockObject)
                {
                    string Str = "最近打开项目：";

                    if (!_dataCollection.ContainsKey(Str))
                    {


                        GalleryCategoryData<RecentProjectData> galleryCategoryData = new GalleryCategoryData<RecentProjectData>();


                        int index = 1;

                        for (int i = ConfigService.DefaultService.SettingInfo.RecentFile.Count - 1; i > ConfigService.DefaultService.SettingInfo.RecentFile.Count - 7 && i >= 0; i--)
                        {
                            History h = ConfigService.DefaultService.SettingInfo.RecentFile[i];

                            RecentProjectData recentProjectData = new RecentProjectData()
                            {
                                Index = index,
                                Label = h.ProjName,
                                //Command=ModFlow.Application.ModflowV2Commands.EditHani
                                //LargeImage = new Uri("/HA.ModFlow.Application;component/Images/main.png", UriKind.RelativeOrAbsolute),

                                //ToolTipTitle=h.FilePath,
                                //ToolTipDescription=h.FilePath

                            };


                            galleryCategoryData.GalleryItemDataCollection.Add(recentProjectData);

                            index++;

                        }





                        _dataCollection[Str] = galleryCategoryData;

                    }

                    return _dataCollection[Str];
                }
            }
        }


        List<History> _histories = new List<History>();



        public List<History> RecentFiles
        {
            get {



                return this._histories;
            }
         
 
        }


    }
}
